<?php

namespace App\Http\Controllers\V1\Api;

use App\Models\V1\Advert;

use App\Models\V1\News;
use App\Models\V1\Notice;
use App\Models\V1\Position;
use Illuminate\Http\Request;

class NoticeController extends BaseController
{

    /**
     * 公告列表
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function List(Request $request)
    {
        $query = Notice::with('noticeClass');
        $pageSize = $request->input('pageSize', 10);
        $order = $request->input('order', 'desc');
        $sort = $request->input('sort', 'created_at');
        if ($request->filled('notice_class_id')) {
            $query->where('notice_class_id', $request->input('notice_class_id'));
        }
        $query->where('state', 1);
        $query->orderBy($sort, $order);
        $data = $query->paginate($pageSize);
        return ajax_output(200, "成功", $data);
    }





}
